<template>
    <div>
        <van-nav-bar title="会员注册" fixed />
        <div style=" width: 100%; height: 45px;"></div>
        <van-form @submit="onSubmit">
            <van-cell-group inset>
                <van-field v-model="username" type="username" name="username" label="账号" placeholder="请输入账号"
                    :rules="[{ required: true, message: '请填写账号' }]" />
                <van-field v-model="password" type="password" name="password" label="密码" placeholder="请输入密码"
                    :rules="[{ required: true, message: '请填写密码' }]" />
                <van-field v-model="password" type="password" name="password" label="密码" placeholder="请输入密码"
                    :rules="[{ required: true, message: '请填写密码' }]" />
                <van-field v-model="value1" label="姓名" name="姓名" placeholder="输入姓名"
                    :rules="[{ pattern, message: '请输入姓名' }]" />
                <van-field v-model="value2" label="邮箱" name="邮箱" placeholder="请输入邮箱"
                    :rules="[{ pattern, message: '请输入邮箱' }]" />
                <van-field v-model="tel" type="tel" label="手机号" placeholder="请输入手机号"
                    :rules="[{ pattern, message: '请输入正确的手机号' }]" />
                <van-cell-group inset>
                    <van-field v-model="message" rows="1" autosize label="留言" type="textarea" placeholder="请输入留言" />
                </van-cell-group>
                <van-cell-group inset>

                </van-cell-group>
            </van-cell-group>
            <div style="margin: 16px;">
                <van-button round block type="primary" native-type="submit" style="background: red; color: #fff;">
                    登录
                </van-button>
            </div>
        </van-form>
    </div>
</template>

<script setup>
import { ref } from 'vue';
const username = ref('');
const password = ref('');
const value1 = ref('');
const value2 = ref('');
const onSubmit = (values) => {
    console.log('submit', values);
    if (username.value == '13', password.value == '123456') {
        alert('登录成功')
        router.push('/home')
    }
    else {
        alert('登陆失败')
        username.value == null;
        password.value == null;

    }
};
import { useRouter } from "vue-router";
let router = useRouter();
</script>

<style lang="scss" scoped></style>